package com.demo.connectdbtest.module.exportrecord.helper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class ExportRecordHelper {

    private static final Logger log = LoggerFactory.getLogger(ExportRecordHelper.class);

    /*@Autowired
    private ExportRecordsMapper exportRecordsMapper;

    @Autowired
    private UserHelper userHelper;

    *//**
     * @param userId          登录用户id
     * @param searchCondition 搜索条件
     * @param exportType      ExportCategoryTypeEnum中定义的类型
     * @return
     *//*
    public ExportRecords getByTypeAndCondition(Long userId, String searchCondition, String exportType) {
        log.debug("查询excel导出记录，条件userId={},searchCondition={},exportType={}", userId, searchCondition, exportType);
        ExportRecordsExample exportRecordsExample = new ExportRecordsExample();
        exportRecordsExample.createCriteria().andUserIdEqualTo(userId).andSearchConditionEqualTo(searchCondition)
                .andExportCategoryEqualTo(exportType);
        List<ExportRecords> exportRecords = exportRecordsMapper.selectByExample(exportRecordsExample);
        if (CollectionUtils.isNotEmpty(exportRecords)) {
            return exportRecords.get(NumberEnums.ZERO.getNum());
        }
        return null;
    }

    *//**
     * 补充新增导出记录的数据
     *
     * @param fileName
     * @param exportDataType
     * @param searchCondition
     * @param exportFileType
     * @param storageFileName 存储文件名（要唯一）
     * @return
     *//*
    public ExportRecords setExportRecordAttribute(String fileName, String exportDataType, String searchCondition, String exportFileType, String storageFileName, ExportCategoryTypeEnum categoryTypeEnum) {

        ExportRecords exportRecord = new ExportRecords();
        exportRecord.setName(fileName);
        exportRecord.setUserId(userHelper.getLoginUser().getId());
        exportRecord.setStatus(ExportStatusEnum.LOADING.getStatus());
        exportRecord.setExportCategory(exportDataType);
        exportRecord.setSearchCondition(searchCondition);
        exportRecord.setExpFormat(exportFileType);
        if (Objects.nonNull(categoryTypeEnum)) {
            exportRecord.setStorageAddress("/data/logs/uploads/excel/" + categoryTypeEnum.name() + "/" + storageFileName);
        } else {
            exportRecord.setStorageAddress("/data/logs/uploads/excel/" + storageFileName);
        }
        exportRecord.setCreateTime(System.currentTimeMillis());
        exportRecord.setUpdateTime(System.currentTimeMillis());
        return exportRecord;
    }
*/

}
